import {DarkTheme, DefaultTheme, ThemeProvider} from '@react-navigation/native';
import {useFonts} from 'expo-font';
import {Stack} from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import {StatusBar} from 'expo-status-bar';
import {useEffect, useState} from 'react';
import 'react-native-reanimated';
import '@/i18n'
import {useColorScheme} from '@/hooks/useColorScheme';
import PageTopBackBtn from "@/components/PageTopBackBtn";
// import {Provider} from "@ant-design/react-native";
import store from "@/store";
import { Provider } from 'react-redux';

// import WeChat from 'react-native-wechat-lib';
//
// WeChat.registerApp('wx10684715b8f3b501');


// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();

export default function RootLayout() {
    const colorScheme = useColorScheme();
    const [loaded] = useFonts({
        SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),// 字体文件路径
        FcIconFont: require('../assets/fonts/iconfont.ttf'), // 字体图标文件路径
    });

    useEffect(() => {
        if (loaded) {
            SplashScreen.hideAsync();
        }
    }, [loaded]);

    if (!loaded) {
        return null;
    }

    return (
        <Provider store={store}>

        <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
            {/*<antProvider>*/}
                <Stack>
                    <Stack.Screen name="login" options={{headerShown: false}}/>
                    <Stack.Screen name="index" options={{headerShown: false}}/>
                    <Stack.Screen name="(tabs)" options={{headerShown: false}}/>
                    <Stack.Screen name="+not-found"/>
                    <Stack.Screen name="keywordExplosion" options={{headerShown: false}}/>
                    <Stack.Screen name="benchmarkingAccount" options={{ headerShown: false}} />
                    <Stack.Screen name="morePlatforms" options={{headerShown: false}}/>
                    <Stack.Screen name="aiInnovation" options={{headerShown: false}}/>
                    <Stack.Screen name="aiOriginality" options={{headerShown: false}}/>
                    <Stack.Screen name="explosiveFission" options={{headerShown: false}}/>
                    <Stack.Screen name="useExplosive" options={{headerShown: false}}/>
                    <Stack.Screen name="aiFeeding" options={{headerShown: false}}/>
                    <Stack.Screen name="questionsAndAnswers" options={{headerShown: false}}/>
                    <Stack.Screen name="contentManage" options={{headerShown: false}}/>
                    <Stack.Screen name="videoPublish" options={{headerShown: false}}/>
                    <Stack.Screen name="videoAndPictrue" options={{headerShown: false}}/>
                    <Stack.Screen name="my" options={{headerShown: false}}/>
                    <Stack.Screen name="localWriting" options={{headerShown: false}}/>
                    <Stack.Screen name="search" options={{headerShown: false}}/>
                </Stack>
                <StatusBar style="auto"/>
            {/*</antProvider>*/}
        </ThemeProvider>
        </Provider>
    );
}
